package com.fmjava.service_video.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fmjava.service_video.entity.Video;
import com.fmjava.service_video.mapper.VideoMapper;
import com.fmjava.service_video.service.VideoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 作品视频 服务实现类
 * </p>
 *
 * @author fmjava
 * @since 2021-07-19
 */
@Service
public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements VideoService {

    @Override
    public List<Video> getVideoWithContentId(String id) {
        QueryWrapper<Video> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("chapter_id",id);
        List<Video> videoList = baseMapper.selectList(queryWrapper);

        return videoList;
    }

    @Override
    public void deleteVideo(String id) {
        QueryWrapper<Video> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("content_id",id);
        baseMapper.delete(queryWrapper);
    }
}
